'use strict';

module.exports = {
  getServerUrl(instance) {
    let url = '';
    const http = 'http://';
    const https = 'https://';
    if (instance) {
      if (instance.port && instance.port['@enabled'] === 'true') {
        url = http + instance.ipAddr + ':' + instance.port.$;
      } else if (instance.securePort && instance.securePort['@enabled'] === 'true') {
        url = https + instance.ipAddr + ':' + instance.securePort.$;
      }
    }
    return url;
  },
};
